REPORT SET_TABLE.
DATA: OK_CODE TYPE SY-UCOMM,
    SAVE_OK TYPE SY-UCOMM.

DATA: WA_SPFLI TYPE TABLE OF SPFLI.

SELECT * INTO TABLE WA_SPFLI FROM SPFLI.

*定义窗口定制控制，定义ALV对象
DATA: WA_CONTAINER TYPE SCRFNAME VALUE 'SCREEN1', "窗口名称
ALV_GRID TYPE REF TO CL_GUI_ALV_GRID,
WA_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

*定义事件类型
CLASS LCL_EVENT_RECEIVER DEFINITION DEFERRED.

DATA EVENT_RECEIVER TYPE REF TO LCL_EVENT_RECEIVER.

CALL SCREEN 100.

CLASS LCL_EVENT_RECEIVER DEFINITION.
    PUBLIC SECTION.
        METHODS:
            HANDLE_DOUBLE_CLICK
            FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
            IMPORTING E_ROW E_COLUMN.
ENDCLASS.

CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
    METHODS HANDLE_DOUBLE_CLICK.
        DATA: LI_SPFLI LIKE LINE OF WA_SPFLI.
        READ TABLE WA_SPFLI INDEX E_ROW-INDEX INTO LI_SPFLI.
        *将行列等信息合并到字符串
        DATA: S1(100) TYPE C.
        CONCATENATE '行：' E_ROW-INDEX '列名：' E_COLUMN-FIELDNAME INTO S1.
        CONCATENATE S1 'CONNID:' LI_SPFLI-CONNID INTO S1.
        CONCATENATE S1 'CARRID:' LI_SPFLI-CARRID INTO S1.
        *在状态条显示单机的行与列信息
        MESSAGE S1 TYPE 'S'.
    ENDMETHOD.  
ENDCLASS.

MODULE STATUS_0100 OUTPUT.
    IF WA_CUSTOM_CONTAINER IS INITIAL.
        CREATE OBJECT WA_CUSTOM_CONTAINER
        EXPORTING
        CONTAINER_NAME = WA_CONTAINER.

        CREATE OBJECT ALV_GRID
        EXPORTING
        I_PARENT = WA_CUSTOM_CONTAINER.

        CREATE METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
        I_STRUCTURE_NAME = 'SPFLI'
        CHANGING
        IT_OUTTAB = WA_SPFLI.

        
        CREATE OBJECT EVENT_RECEIVER.
        SET HANDLER EVENT_RECEIVER->HANDLE_DOUBLE_CLICK
        FOR ALV_GRID.
    ENDIF.
ENDMODULE.

MODULE USER_COMMAND_0100 INPUT.
    SAVE_OK = OK_CODE.
    CLEAR OK_CODE.
    CASE SAVE_OK.
        WHEN 'EXIT'.
            LEAVE PROGRAM.
    ENDCASE.
ENDMODULE.